<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
      matchAll 返回一个可迭代对象
      */
      const str = "2023-12-21,2012-12-22";
      const r = str.matchAll(/(\d{4})-(\d{2})-(\d{2})/g);
      // console.log(Array.from(r));
      console.log([...r]);
    </script>
  </body>
</html>
